vcNode

Object type for nodes, which are used by components and other objects to form tree structures.

See in: Overview

Module: vcCore

Parent: vcObject

Children: vcComponent, vcLayout, vcLinkNode

Referenced by: vcAnnotation.Node, vcApplication.loadVCMX(), vcAuthorContext.ActiveNode, vcBaseFrame.Node, ... (see more)
vcAnnotation.Node
vcApplication.loadVCMX()
vcAuthorContext.ActiveNode
vcBaseFrame.Node
vcBehavior.Node
vcCollisionRecord.NodeA
vcCollisionRecord.NodeB
vcCore.getNode()
vcDimension.Node1
vcDimension.Node2
vcKinematics.FlangeNode
vcKinematics.RootNode
vcLinkJoint.ParentNode
vcPickedTopologyCurveInfo.Node
vcRaycastResult.Node
vcServoController.FlangeNode
vcServoController.RootNode
vcSetBaseStatement.Node
vcSetToolStatement.Node
vcSimAttachmentField.ConnectedTo
vcSimAttachmentField.Node
vcSimHierarchyField.Node
vcSweptVolume.TargetNode
vcTransportTarget.ProductPositionNode
vcTransportTarget.ResourcePositionNode
vcVolumeDetector.getHitNode()

Properties

Learn how to use properties here. The properties are also inherited from the parent class.

NameTypeAccessDescription
BehaviorsvcList[vcBehavior]RGets a list of all behaviors within this node.
BoundingBoxvcBoundingBoxRGets the bounding box of node.
ChildrenvcList[vcNode]RGets a list of node's immediate child nodes.
ComponentvcComponentRGets the component of node.
GeometryvcGeometryContainerRGets the container of geometry in node.
InverseWorldPositionMatrixvcMatrixRGets inverse of node's position matrix in World coordinate system.
MaterialInheritancevcMaterialInheritanceRWGets or sets the mode for managing NodeMaterial property. For example, node material could override feature materialsand child nodes.
NameStringRWGets or sets node name.

Exceptions:
ValueError: When given name is empty or not unique.
NodeMaterialvcMaterialRWGets or sets the node's material. This
See more
property is used with MaterialInheritance to define how the node's material is assigned to its features and child nodes.
NodeVisibleBooleanRWGets or sets the visibility of the node but not its child nodes.
ParentvcObjectRGets the parent node of this node.
PositionMatrixvcMatrixRWGets or sets the position matrix of a node in parent coordinate system.
PropertiesvcPropertyContainerRGets the properties of this node.
RootFeaturevcFeatureRGets the root feature of node.
TypevcSimNodeTypeRGets the node's type
UserGeometryvcGeometryContainerRGets a container of geometry that is unique to the node. That is, the geometry of this container is never shared with other nodes.
VisibleBooleanRWGets or sets the visibility of the node and its child nodes.
WorldvcWorldRObject type for nodes, which are used by components and other objects to form tree structures.
WorldPositionMatrixvcMatrixRWGets the position matrix of node in World coordinate system.

Methods

Learn how to use methods here. The methods are also inherited from the parent class.

NameReturn TypeParametersDescription
attachChildNonevcNode childNode,
Optional Keyword[permanent = Boolean]
Attaches a given node to this node as a child.
See more
Parameters:
childNode (vcNode): A node to attach to.
permanent (Boolean): When set to False, the attachment will be reset on simulation reset.

Exceptions:
ValueError: When adding non-component to a world.
ValueError: When adding world as a child to another node.
ValueError: When adding parent of a node as its child.
ValueError: When the node hierarchy is locked.
createBehaviorvcBehaviorvcBehaviorType type,
String name,
Optional Keyword[useExisting = Boolean]
Creates a new behavior of a given type and name in this node.
See more
Parameters:
type (vcBehaviorType): The behavior type to create.
name (String): The name for the newly created behavior.
useExisting (Boolean): Whether to return an existing behavior with the given name name if True, or throw an error if the name is not unique if False. Defaults to False.

Exceptions:
RuntimeError: When there is no license for Modeling API or a more specific API required to create the desired type of behavior.
ValueError: When behavior creation failed.

Returns:
vcBehavior: Newly created behavior object.
deleteNoneNoneDeletes the node.
See more
Exceptions:
RuntimeError: When there is no license for Modeling API.
RuntimeError: When the node or its sub-tree contains the calling Python script.
RuntimeError: When the node is in transition.
RuntimeError: When the node hierarchy is locked.
findBehaviorvcBehaviorString name,
Optional Keyword[searchScope = vcNodeTreeScope]
Gets the first behavior matching a given name within given search scope.
See more
Parameters:
name (String): Behavior's name to search for.
searchScope (vcNodeTreeScope): Indicates the extent of the search.

Returns:
vcBehavior: Behavior matching given name; otherwise None.
findBehaviorvcBehaviorvcBehaviorType type,
Optional Keyword[searchScope = vcNodeTreeScope]
Gets the first behavior matching a given type within given search scope.
See more
Parameters:
type (vcBehaviorType): The behavior type to search for.
searchScope (vcNodeTreeScope): Indicates the extent of the search.

Returns:
vcBehavior: Behavior matching given type, or None when no behavior match the search criteria.
findFeaturevcFeatureString name,
Optional Keyword[searchScope = vcNodeTreeScope]
Returns the first feature matching a given name within given search scope.
See more
Parameters:
name (String): Feature's name to search for.

Returns:
vcFeature: Feature matching given name; otherwise None.
findNodevcNodeString name,
Optional Keyword[searchScope = vcNodeTreeScope]
Finds the first child node matching a given name.
See more
Parameters:
name (String): Node's name to search for.
searchScope (vcNodeTreeScope): Indicates the extent of the search.

Returns:
vcNode: Found node matching the given name; otherwise None.
getBehaviorslist[vcBehavior]Optional Keyword[retrievalScope = vcNodeTreeScope]Gets a list of all behaviors within given retrieval scope.
See more
Parameters:
retrievalScope (vcNodeTreeScope): Indicates the extent of the retrieval.

Returns:
List of vcBehaviors: All behaviors within retrieval scope.
getChildComponentslist[vcComponent]Optional Keyword[searchScope = vcNodeTreeScope]Gets a list of all components attached to the node.
See more
Parameters:
searchScope (vcNodeTreeScope): Indicates the extent of the search.

Returns:
List of vcComponents: All components attached to given node.
localToWorldvcVectorvcVector vectorTransforms given vector from node's local coordinate system to the world coordinate system.
See more
Parameters:
vector (vcVector): vector in node's local coordinate system.

Returns:
vcVector: vector in world coordinate system.
localToWorldvcMatrixvcMatrix matrixTransforms given matrix from node's local coordinate system to the world coordinate system.
See more
Parameters:
matrix (vcMatrix): matrix in node's local coordinate system.

Returns:
vcMatrix: matrix in world coordinate system.
rebuildNoneOptional Keyword[updateTree = Boolean]Rebuilds the geometry of node by re-evaluating its feature tree.
See more
Note: Try to avoid using this method during a simulation.

Parameters:
updateTree (Boolean): When True, rebuilds also node's sub-tree, including any child components.

Exceptions:
RuntimeError: When rebuilding node that is in process of being removed.
updateNoneOptional Keyword[updateTree = Boolean]Updates the node.
See more
Parameters:
updateTree (Boolean): When True, updates also node's sub-tree, including any child components.
worldToLocalvcVectorvcVector vectorTransforms given vector from world coordinate system to the node's local coordinate system.
See more
Parameters:
vector (vcVector): vector in world coordinate system.

Returns:
vcVector: vector in node's local coordinate system.
worldToLocalvcMatrixvcMatrix matrixTransforms given matrix from world coordinate system to the node's local coordinate system.
See more
Parameters:
matrix (vcMatrix): matrix in world coordinate system.

Returns:
vcMatrix: matrix in node's local coordinate system.

Events

Learn how to use events here. The events are also inherited from the parent class.

NameParametersDescription
OnNodeTransformvcNode nodeTriggered when node's pose in the world changes.

Parameters:
node (vcNode): The transformed node.

Example: Create New Behavior

""" This example shows how to create a new behavior. """

import vcCore as vc
import vcBehaviors as vc_beh

comp = vc.getComponent()
sensor_signal = comp.createBehavior(vc_beh.vcBehaviorType.BOOLEAN_SIGNAL, "SensorSignal")

Example: Node Visibility Toggle

"""Toggle node visibility"""
import vcCore as vc

comp = vc.getComponent()
node = comp.findNode('Axis 2')
# Tested with Generic Articulated Robot
node.NodeVisible = False

Example: Node Access

"""Access the node that owns this script, and its parent and children nodes"""
import vcCore as vc

node = vc.getNode()
parent = node.Parent
print(parent)

# Access immediate child of a node
children = node.Children
for child in children:
  print(child)

# Access many children of the node
def recursive_loop(node):
  children = node.Children
  for child in children:
    print(child)
    recursive_loop(child)

recursive_loop(node)

Example: Node Attach

"""Attach one node (or component) to another during simulation run"""
import vcCore as vc

node = vc.getNode() # vc.getComponent() would also work
world = vc.getWorld()
other = world.findComponent('example')


async def OnRun():
  print(node.Children)
  # Retain position: node -> world -> other 
  mtx = node.InverseWorldPositionMatrix * other.WorldPositionMatrix
  node.attachChild(other, False) # True value for permanent attachment, False to detach upon reset
  other.PositionMatrix = mtx
  print(node.Children)